<!--
 * @Description: 第三章-历史记录
 * @Author: IA ia@kepro.space
 * @Date: 2025-02-27 01:28:09
-->
<template>

    <div>
        <h1>第三章-历史记录</h1>
        <hr />
        <div>
            <router-link replace to="/footer/">login</router-link>
            <router-link replace to="/footer/reg" style="margin-left: 10px;">reg</router-link>
            <button @click="toPage3('./')" style="margin-left: 10px;">login route replace url</button>
            <button @click="toPage3('./footer/reg')" style="margin-left: 10px;">reg route replace url</button>

            <button @click="prev()" style="margin-left: 10px;">prev</button>
            <button @click="next()" style="margin-left: 10px;">next</button>
        </div>
    </div>

</template>
<script setup lang="ts">
import { useRouter } from 'vue-router'

const router = useRouter()

const toPage3 = (url: string) => {
  router.replace(url)
}

const next = () => {
  router.go(1)
}

const prev = () => {
  // 往前走-1，等于往后倒1
  // router.go(-1)
  // 往后倒1
  router.back()
}
</script>
<style scoped></style>